package bma.common.langutil.concurrent;

import java.util.concurrent.Future;

/**
 * 可推送结果的Future
 * 
 * @author 关中
 * 
 * @param <TYPE>
 */
public interface ListenableFuture<TYPE> extends Future<TYPE> {

	/**
	 * Adds the specified listener to this future. The specified listener is
	 * notified when this future is {@linkplain #isDone() done}. If this future
	 * is already completed, the specified listener is notified immediately.
	 */
	void addListener(FutureListener<TYPE> listener);

	/**
	 * Removes the specified listener from this future. The specified listener
	 * is no longer notified when this future is {@linkplain #isDone() done}. If
	 * the specified listener is not associated with this future, this method
	 * does nothing and returns silently.
	 */
	void removeListener(FutureListener<TYPE> listener);
}
